#!/bin/bash

#-------------------------------------------------------------------------------
# hscCallHomeEEInfo.sh
#
# This shell script is invoked to call home extended error information.
#
# Usage: hscCallHomeEEInfo <fullyQualifiedFileNameOfEEProperties>
#
# Return Codes:
# 0 - Call home operation has been successfully started.
# 1 - Call home operation failed because the file permissions could not be set.
# 3 - Call home operation failed because the file name was not specified.
# 4 - Call home operation failed because the file name was not found.
#-------------------------------------------------------------------------------

# Verify that a file was specified.
if [ $# -lt 1 ] ; then
  exit 3
fi

# Change the file permissions of the file so that the service agent can 
# delete the file after reading it.
chmod a+w ${1}
if [ $? -eq 0 ] ; then
    # The file permissions have been successfully so call the service agent.
    /usr/svcagent/bin/callsa -f ${1}

    # Return the exit status code returned by the service agent.
    exit $?
else
    # The file permissions have not been successfully set.
    exit 1
fi
